import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 查询维修组合主表
export const findGroupItem = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findGroupItem`, {
    params
  });
// 查询维修项目
export const findRepairProject = (PACKAGE_TYPE_CODE, PACKAGE_TYPE_NAME, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairProject/${PACKAGE_TYPE_CODE}/${PACKAGE_TYPE_NAME}`, {
    params
  });
// 查询维修备件
export const findRepairPart = (PACKAGE_TYPE_CODE, PACKAGE_TYPE_NAME, params) =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairPart/${PACKAGE_TYPE_CODE}/${PACKAGE_TYPE_NAME}`, {
    params
  });
// 查询维修组合项目的维修备件
export const findGroupProjectPart = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findGroupProjectPart`, {
    params
  });
// 查询维修组合品牌車型車繫
export const findAssembleBSM = (packageCode, packageName) => axios.get(`${SERVER.DMSCLOUD_REPAIR}/findAssembleBSM/${packageCode}/${packageName}`, {});
// 查询维修组合代码-下拉框
export const findRepairPackageCode = () => axios.get(`${SERVER.DMSCLOUD_REPAIR}/findRepairPackageCode`, {});
// 保存按钮
export const btnSave = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/repair/group/btnSave`, params);
// 复制按钮
export const copyPackage = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/copyPackage`, params);
// 组合明细确定按钮
export const deletePackage = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/deletePackage`, params);
// 品牌 - 下拉框
export const getPinpSelect = params =>
  axios.get(`/api/basedata/vehicleProduct/brandsqueryall`, {
    params
  });
// 车系 - 下拉框(根据品牌的id)
export const getChexSelect = (brandId, params) =>
  axios.get(`/api/basedata/vehicleProduct/brandsdict/${brandId}/seriessdict`, {
    params
  });
// 车型 - 下拉框()
export const getCheModelSelect = (brandsid, seriessid, params) =>
  axios.get(`/api/basedata/vehicleProduct/brandsdict/${brandsid}/seriessdict/${seriessid}/modelsdict`, {
    params
  });
export const getModels = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/getModels`, {
    params
  });
// 查询维修项目的备件信息
export const selectRepairProjectPart = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findProjectPart`, {
    params
  });
// 获取库存备件信息
export const getpartStocksList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findAllPart`, {
    params
  });
// 获取未被使用的库位
export const getPosition = params =>
  axios.get(`${SERVER.DMSCLOUD_PART}/stockmanage/partmanage/queryLocations/`, {
    params
  });
// 获取所有维修项目
export const findAllProject = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findAllProject`, {
    params
  });
// 获取工单信息
export const findRepairOrderList = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairOrder`, {
    params
  });
// 获取工单的维修项目信息
export const findRepairOrderProject = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairOrderProject`, {
    params
  });
// 获取工单维修项目的备件信息
export const findRepairOrderProjectPart = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/findRepairOrderProjectPart`, {
    params
  });
// 删除维修组合
export const delteRepairGroupProject = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/delteRepairGroupProject`, {
    params
  });
// 查询全部车系
export const getVehicleSeries = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/baseData/basicData/series`, {
    params
  });
// 根据车系查询车型
export const getVehicleModel = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/baseData/basicData/selectmodel`, {
    params
  });
// 查询所有人
export const getDealerUser = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/basedata/users/getDealerUser`);
// 仓库 -下拉框
export const getStroageList = params =>
  axios.get(`${SERVER.DMSCLOUD_PART}/basedata/partStocks/findUserControlStorageCode`, {
    params
  });
// 导出
export const exportGroupItem = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/export/excel`, {
    params,
    responseType: 'arraybuffer'
  });
//  导入模板
export const repairCombload = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/repair/group/repairCombDownload`, {
    params,
    responseType: 'arraybuffer'
  });

  // 经销商多级授权导入模板路径
  export const repairAbleDownload = params =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/basedata/repairParam/exportRepairAbleDownload`, {
    params,
    responseType: 'arraybuffer'
  });

